<template>
	<view class="content">
		
		<block v-for="(item, index) in dataList" :key="index">
			<carousel  v-if="item.type == 'carousel'" :res="item.list" :listStyle="item.style"/>
			<menuSingleOne v-if="item.type == 'menuSingleOne'"  :res="item.data" :listStyle="item.style"/>
			<menuLayout v-if="item.type == 'menu'" :res="item.list" :listStyle="item.style"/>
			<menu4x v-if="item.type == 'menu4x'" :res="item.list" :listStyle="item.style"/>
			<card v-if="item.type == 'card'" :res="item.list" :listStyle="item.style"/>
		</block>
		
		<!-- <view class="address xztv-row xztv-col-center" v-if="address!=''">
			<view style="height:32rpx;display: flex;">
				<image src="../../static/position.png" style="width:28rpx;height:32rpx;"/>
			</view>
			<view style="height:24rpx;display: flex;margin-left:4rpx;">
				<text style="color:white;font-size: 24rpx;line-height: 24rpx;;">{{address}}</text>
			</view>
		</view> -->
	</view>
</template>

<script>
	import tpl_banner from "@/pages/index/template/tpl_banner"; //轮播图模块
	import tpl_menu_single_one from "@/pages/index/template/tpl_menu_single_one.vue"; //首页视频直播
	import tpl_menu from "@/pages/index/template/tpl_menu.vue"; //菜单模块
	import tpl_menu4x from "@/pages/index/template/tpl_menu4x.vue"; 
	import tpl_card from "@/pages/index/template/tpl_card.vue"; 
	
	import { getIndexData } from '@/api/index'
	import storage from "@/utils/storage.js";
	export default {
		components: {
			carousel: tpl_banner,
			menuSingleOne: tpl_menu_single_one,
			menuLayout:tpl_menu,
			menu4x:tpl_menu4x,
			card:tpl_card
		},
		data() {
			return {
				title: 'Hello',
				bannerList:[
					{img:"https://www.hzymt.zfbzhsq.com/static/applet/images/banner1.webp"},
					{img:"https://www.hzymt.zfbzhsq.com/static/applet/images/banner2.webp"}
				],
				bannerStyle:{
					
				},
				address:"",
				dataList:[],
				menuSingleOne1:{title:"便民服务"},
				menuSingleOne2:{title:"生活服务"},
				menuList:[
					{title:"手机充值",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/recharge.png",
					url:"https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021001107610820%26page%3Dpages%252Ftop-up%252Fhome%252Findex%26enbsv%3D0.2.2201172105.47%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3DAEBDD13E-5168-4B40-A001-B959D732785C"},
					{title:"水电燃缴费",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/ele.png",
					url:"https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021001164644764%26page%3Dpages%252Findex%252Findex%26enbsv%3D0.2.2202111039.25%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3DB1A3CBD8-F667-440E-B201-23463878FE6A"},
					{title:"车生活",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/car.png",
					url:"https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021001136634093%26page%3Dpages%252Findex%252Findex%26enbsv%3D0.2.2202101439.18%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D69805AB6-6276-4643-A232-D9F5C0E84EA0"},
					{title:"我的快递",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/express.png",
					url:"https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021001102660294%26page%3Dpages%252Findex%252Findex%26enbsv%3D0.2.2201261756.55%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D8037BFF2-817A-4D4D-8F3F-8DAD1ACEE0E2"},
					{title:"医疗健康",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/medical.png",
					url:"https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2018091361395351%26page%3Dpages%252Findex%252Findex%26enbsv%3D0.2.2201261942.25%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D7694D488-3EFE-4847-8B72-9652EBD765AD"},
					{title:"家政到家",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/home.png",
					url:"https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021002130684342%26page%3D%252Fpages%252Fhome%252Findex%253Fsource%253D3537%2526pid%253D%2526utmSource%253D%2526spm%253D%2526tf_city%253D%2526tf_media%253D%2526tf_cate%253D%2526weixinadinfo%253D%2526gdt_vid%253D%26enbsv%3D0.2.2202111741.4%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D7E99B273-A5A7-4D44-8B12-83C9DAE80EAC"},
				],
				menuList2:[
					{title:"爱心公益",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/1.png",
					url:"https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2019052265312523%26page%3D%252Fpages%252Findex%252Findex%26enbsv%3D0.2.2202091824.39%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D8540C48D-2CAD-49F4-8ADA-031F1B432E1B"},
					{title:"住房公积金",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/2.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2019060365493242%26page%3D%252Fpages%252Findex%252Findex%252Findex%26enbsv%3D0.2.2201300918.3%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D77CBB754-ADFC-45E0-88DB-ACBFA6321253'},
					{title:"电子医保卡",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/3.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D20002069%26fromSource%3Dshare%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D86403264-68D4-4070-B74B-8FF35348743A'},
					{title:"电子社保卡",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/4.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D20000067%26url%3Dhttps%253A%252F%252Frender.alipay.com%252Fp%252Fs%252Fmedical-card-online%252Fwww%252Findex.html%253F__webview_options__%253D%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D2AD5433F-2610-4D2B-81C6-1F336D1357AC'},
					{title:"社区运动会",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/5.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2019072565980504%26page%3Dpages%252Findex%252Findex%253FchInfo%253Dself_share%26enbsv%3D0.7.2205232016.22%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D934341FE-0F02-4F7D-BC7E-B3CCF8C8313C'},
					{title:"淘宝特价",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/6.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021001140676678%26page%3Dpages%252Fhome%252Findex%26enbsv%3D0.2.2201261458.32%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D2EF48044-0036-4FBC-A869-8A6AB7217247'},
					{title:"蚂蚁回收",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/7.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021002193653882%26page%3Dpages%252Findex%252Findex%26enbsv%3D0.2.2112301103.0%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3DD8E67EFE-33B3-47D4-AA3C-8B9F96071167'},
					{title:"云宠生活",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/8.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2021002142629699%26page%3Dpages%252Findex%252Findex%26enbsv%3D0.2.2202122229.30%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D28A94DAD-C136-43B3-8EC6-E8E5A729E068'},
					{title:"高德打车",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/9.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D2018070960585195%26page%3Dpage%252Fmap-index%252Fmap-index%26enbsv%3D0.5.2202281634.48%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3DED35ED6C-3E45-4F0D-8B67-71165BF780E5'},
					{title:"消费劵",img:"https://www.hzymt.zfbzhsq.com/static/applet/icon/10.png",
					url:'https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D68687742%26etOperationType%3Dcom.alipay.promofrontcenter.coupon.router.decide%26etIntercept%3DYES%26chInfo%3Dch_share__chsub_CopyLink%26apshareid%3D05CE1B87-4FBA-46C3-AEFF-FB18E8F3198A'},
				],
			}
		},
		onLoad() {
			this.getData();
			let that=this;
			// my.getLocation({
			// 	type:2,
			// 	success: function (res) {
			// 		that.address=res.district+res.streetNumber.street
			// 		res.streetNumber.street;
			// 		console.log("res",JSON.stringify(res));
			// 		console.log('当前位置的经度：' , res.district+res.streetNumber.street);
			// 	},
			// 	fail: (err) => {
			// 		console.log("error",JSON.stringify(err));
				    
			// 	},
			// });
			
		},
		onPullDownRefresh() {
			storage.setHasLogin(false);
			storage.setAccessToken("");
			storage.setBindRoom(false);
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onShow(){
			
		},
		methods: {
			getData(){
				getIndexData().then((res)=>{
					if(res.data.code==0){
						this.dataList=res.data.data
					}
					console.log("getBanner",res);
				})
			}
		}
	}
</script>

<style>
	.xztv-row {
		display: flex;
		flex-direction: row;
	}
	
	.xztv-column {
		display: flex;
		flex-direction: column;
	}
	.xztv-col-center {
		align-items: center;
	}
	.xztv-row-center {
		justify-content: center;
	}
	/* 垂直居中 */
	.xztv-vertical-center {
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		width:750rpx;
		position: relative;
	}
	.address{
		position: absolute;
		height:40rpx;
		top:10rpx;
		right:40rpx;
		background-color: rgba(0, 0, 0, 0.5);
		padding-left: 10rpx;
		padding-right: 10rpx;
		border-radius: 8rpx;
	}
	

	
</style>
